package com.itheima.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/*
Collection 的遍历
 */
public class Demo02 {

    public static void main(String[] args) {
        Collection<String> list= new ArrayList<>();
        list.add("坤坤");
        list.add("签签");
        list.add("滔滔");
        list.add("小鹿鹿");


        //遍历
        //获取迭代器
        Iterator<String> iterator = list.iterator();
        /*while (iterator.hasNext()) {
            //System.out.println(iterator.hasNext());

            String next = iterator.next();
            System.out.println(next);
        }*/
       // iterator.remove();
        System.out.println(list);
        iterator.next();
        iterator.remove();
        System.out.println(list);

    }
}
